<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript">
$(function(){
	$("#submit_button").bind("click",singleSignIn);
	$("#reg").bind("click",open);
	$("#lo").bind("click",logout);
});
function singleSignIn(){
	var username=$("#username").val();
	var password=$("#password").val();

	$.ajax({
	    type: "POST",
	    url: "http://www.sxz.edu.cn/szuc/login.htm?username="+username+"&password="+password,
	    dataType: "jsonp",
	    success: function(data){
	    	eval(data);
	    }
	});
	
	return false;
}
function afterLogin(){
	location.reload();
}
function relogin(){
	alert('登录失败！请重新登录！');
}

function logout(){
	$.ajax({
	    type: "POST",
	    url: "http://www.sxz.edu.cn/logout.sso",
	    dataType: "jsonp",
	    error: function(data){
			location.reload();
	    }
	});
}

function open()
{
	$('#windows').window('open');
}
</script>

<div id="windows" class="easyui-window" data-options="closed:true,title:'注册'" style="width:580px;height:270px;padding:5px;">
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center',border:false" style="padding:10px;background:#fff;border:1px solid #ccc;">
			<iframe src="http://www.sxz.edu.cn/szuc/register.jsp" frameborder="0" height="190px" width="530px" noresize="noresize"></iframe>
		</div>
	</div>
</div>
<div id="head_function">
	<div style="margin-left:15px;float:left;width:600px;">
		<s:if test="#session.loginUser == null">
			<span>用户名：</span>
			<input type="text" id="username" value="" style="height:22px;">
			<span>密码：</span>
			<input type="password" id="password" value="" style="height:22px;">
			<input type="submit" value="登  录" id="submit_button" style="height:22px; cursor:pointer;background-color:#a90303;color:#FFF;width:60px;">
			<a href="javascript:void(0)" id="reg">注册</a>|
			<a href="http://www.sxz.edu.cn/">找回密码</span>
		</s:if>
		<s:else>
			<span>欢迎，</span>
			<span><s:property value="#session.loginUser.realName"/> &nbsp;[<s:property value="#session.loginUser.rolename"/>]</span>
			<s:if test="#session.loginUser.real==true||#session.loginUser.rid < 4">
				<span><a href="article/manageArticles.action?cid=23">管理后台</a></span>
			</s:if>
			<span><a href="javascript:void(0)" id="lo">退出</a></span>
		</s:else>
	</div>
	
	<div style="float:right;">
		<span style="margin-left:120px;"><a href="http://www.sxz.edu.cn/" target="_blank">主站首页</a></span>|
		<span>主站资源</span>|
		<span>培训</span>|
		<span>管理</span>
	</div>
</div>
<div id="head_banner">
	<div id="head_banner_search">
		<s:form action="resource/searchResource.action?cid=100" theme="simple">	
			<s:textfield name="query" cssStyle="width:250px;"></s:textfield>
			<input type="submit" id="banner_search_button" value=""></input>
		</s:form>
	</div>
</div>
<div id="head_menu">
	<jsp:include page="menu.jsp"></jsp:include>
	<div class="clear"></div>
</div>